package com.droid.library.widget.edittext;

import android.content.Context;
import android.util.AttributeSet;

/**
 *
 * 可以监听上粘贴、复制等事件的EditText
 *
 * @author wangheng
 */
public class ContextMenuEditText extends BaseEditText {


    public ContextMenuEditText(Context context) {
        super(context);
    }

    public ContextMenuEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ContextMenuEditText(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean onTextContextMenuItem(int id) {
        if(mOnTextContextMenuListener != null){
            mOnTextContextMenuListener.onTextContextMenuItem(id);
        }
        return super.onTextContextMenuItem(id);
    }


    private OnTextContextMenuItemListener mOnTextContextMenuListener = null;

    public void setOnTextContextMenuListener(OnTextContextMenuItemListener listener){
        mOnTextContextMenuListener = listener;
    }

    interface OnTextContextMenuItemListener{
        void onTextContextMenuItem(int id);
    }
}